package  control.controlBoxParts
{
	import flash.geom.Point;
	
	import mx.core.UIComponent;
	import mx.styles.IStyleClient;

	public class ControlPoint extends UIComponent
	{
	
		private var _stypeName:IStyleClient;
		
		private var _pos: int;
		
		private var _op: Point;
		
		public function ControlPoint(pos: int,  styleName: IStyleClient)
		{
			super();
			this._pos = pos;
			this.stypeName = styleName;
			draw();
		}
		
		public function get pos():int
		{
			return _pos;
		}
		
		public function get op():Point
		{
			return _op;
		}
		
		public function set op(value: Point):void
		{
			 this._op = value;
		}
	
		public function set stypeName(value: IStyleClient):void
		{
			this._stypeName  = value;
		}
		
		 override protected function updateDisplayList(unscaledWidth:Number,
                                                  unscaledHeight:Number):void
	    {
	        super.updateDisplayList(unscaledWidth, unscaledHeight);
	        draw();
	    }
		
		private function draw():void
		{
			this.graphics.clear();
			var size: int =   _stypeName != null ?  _stypeName.getStyle("controlRecWidth") : 4;
			var color:int  = _stypeName != null ? this._stypeName.getStyle("controlColor") : 0x000000;
			var thinkness: int = _stypeName.getStyle("controlLineThickness");
			var fillColor:int = _stypeName.getStyle("controlColor");
			graphics.lineStyle(thinkness, color);
			graphics.drawRect(0, 0, size, size);	
			graphics.beginFill(fillColor, 1);
			graphics.drawRect(0, 0, size, size);	
			graphics.endFill();
		}
		
	}
}